package cn.ycc1.springquickstart;

import cn.ycc1.springquickstart.util.ApplicationContextUtil;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author ycc
 * @date 2023/12/3
 */
public class TestUser {
    @Test
    public void testUser() {
        // 加载spring配置文件
//        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");
        ApplicationContext context = ApplicationContextUtil.getApplicationContext();

        // 获取对象的创建
        User user = (User)context.getBean("user");
        System.out.println(user);

        // 使用对象调用方法进行测试
        user.add();
    }
}
